<?php

use App\Core\Ioc;

Ioc::getInstance()->single(\App\Job\QueueContract::class, function ($app) {
    return new \App\Job\RedisQueue();
});
\ioc()->single(\App\Elastic\Noval::class);

\ioc()->single('ES', function () {
    return \Elasticsearch\ClientBuilder::create()
        ->setHosts(['es6:9200'])
        ->setConnectionParams([
            'client' => [
                'timeout' => 3,
                'connect_timeout' => 1
            ]
        ])
        ->build();
});
\ioc()->single('request', function () {
    return new \Goutte\Client();
});
//Ioc::getInstance()->single('SWOOLE', function () {
//    return new \App\Core\Server([
//        'worker_num' => 3,
//        'daemonize' => false,
//        'task_worker_num' => 6,
//        'max_request' => 5000,
//        'task_max_request' => 100
//    ]);
//});

Ioc::getInstance()->single('processes', function ($app) {
    return new \App\Worker\Processes($app);
});
